const express = require('express')
const jwt = require('jwt-simple')
const app = express()
const UserInfoRouter = express.Router()
app.set('jwtTokenSecret', 'YOUR_SECRET_STRING')
UserInfoRouter.get('/getUserAll', (req, res) => {
  // var token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ1c2VyIiwiZXhwIjozNjAwMDAwfQ.CaHH-6cxK1PRzkj0SKmBxlz8-hdj3OYNcNIFv-yzKd0'
  // var decoded = jwt.decode(token, app.get('jwtTokenSecret'))
  // if (decoded.exp <= Date.now()) {
  //   var data = {
  //     code: 403,
  //     results: [],
  //     message: '无权限访问'
  //   }
  //   res.json(data)
  // } else {
  //   res.json('验证成功')
  // }
  console.dir(jwt.decode())
  res.json(jwt)
})
module.exports = UserInfoRouter
